package com.dsteiner.gwt.cafeteriasophia.client.domain;

import com.dsteiner.widgets.client.ObjectUtil;
import com.dsteiner.widgets.client.domain.BaseObject;
import com.dsteiner.widgets.client.domain.Searchable;
import com.dsteiner.widgets.client.domain.SearchableProperty;

@Searchable
public class Product extends BaseObject{

	public static Product dinero = new Product();
	public static Product inventarioTarjetas = new Product();
	public static Product agua = new Product();
	public static Product gaseosa = new Product();
	public static Product gatorade = new Product();
	public static Product california = new Product();
	public static Product paleta = new Product();
	public static Product paletaClasica = new Product();
	public static Product vasito = new Product();
	public static Product medioGalon = new Product();
	public static Product litro = new Product();
	public static Product medioLitro = new Product();
	public static Product conoWafflePequeno = new Product();
	public static Product conoWaffleGrande = new Product();
	public static Product conoConoso = new Product();
	public static Product conoWafflePequenoCap = new Product();
	public static Product conoWaffleGrandeCap = new Product();
	public static Product conoConosoCap = new Product();
	public static Product fruitSundae = new Product();
	public static Product bananaSplit = new Product();
	public static Product pepsiFloat = new Product();
	public static Product milkShake = new Product();
	public static Product smoothie = new Product();
	public static Product frappucino = new Product();
	public static Product pinocchio = new Product();
	public static Product baileys = new Product();
	public static Product helados = new Product();
	public static Product guateAzul = new Product();
	public static Product pinaColada = new Product();
	public static Product amarettoColada = new Product();
	public static Product wodkaSunrise = new Product();
	public static Product swimmingPool = new Product();
	public static Product curacaoVerde = new Product();
	public static Product espresso = new Product();
	public static Product cafeAmericano = new Product();
	public static Product cafeLeche = new Product();
	public static Product cappuccino = new Product();
	public static Product moccacino = new Product();
	public static Product chocolate = new Product();
	public static Product poporropos = new Product();
	public static Product cocktails = new Product();
	public static Product jugo = new Product();
	public static Product[] products = new Product[]{dinero, inventarioTarjetas, agua, gaseosa, gatorade, california,
		paleta, paletaClasica, vasito, medioGalon, litro, medioLitro, helados, cocktails, conoWafflePequeno, 
		conoWaffleGrande, conoConoso, conoWafflePequenoCap, conoWaffleGrandeCap, conoConosoCap, fruitSundae, 
		bananaSplit, pepsiFloat, milkShake, smoothie, frappucino, pinocchio, baileys, 
		guateAzul, pinaColada, amarettoColada, wodkaSunrise, swimmingPool, curacaoVerde, 
		espresso, cafeAmericano, cafeLeche, cappuccino, moccacino, chocolate, jugo, poporropos};
	
	static{
		dinero.setName("dinero");
		dinero.setMetric(null);
		dinero.setStockable(true);
		dinero.setSaleable(false);
		
		inventarioTarjetas.setName("dinero tarjetas + tarjetas + recargas");
		inventarioTarjetas.setMetric(null);
		inventarioTarjetas.setStockable(true);
		inventarioTarjetas.setSaleable(false);
		
		agua.setName("agua pura");
		agua.setDefaultPrice(4.0);
		agua.setCost(2.5);
		agua.setStockable(true);
		
		gaseosa.setName("gaseosa");
		gaseosa.setDefaultPrice(5.0);
		gaseosa.setCost(2.5);
		gaseosa.setStockable(true);
		
		gatorade.setName("gatorade");
		gatorade.setDefaultPrice(9.0);
		gatorade.setCost(6.6);
		gatorade.setStockable(true);
		
		california.setName("california");
		california.setDefaultPrice(7.0);
		california.setCost(4.0);
		california.setStockable(true);
		
		paleta.setName("paleta");
		paleta.setDefaultPrice(7.5);
		paleta.setCost(4.62);
		paleta.setStockable(true);
		
		paletaClasica.setName("paleta clasica");
		paletaClasica.setDefaultPrice(4.5);
		paletaClasica.setCost(2.75);
		paletaClasica.setStockable(true);
		
		vasito.setName("vasito");
		vasito.setDefaultPrice(5.00);
		vasito.setCost(3.0);
		vasito.setStockable(true);
		
		medioGalon.setName("medio galon");
		medioGalon.setDefaultPrice(55.0);
		medioGalon.setCost(40.25);
		medioGalon.setStockable(true);
		
		litro.setName("litro");
		litro.setDefaultPrice(33.0);
		litro.setCost(23.80);
		litro.setStockable(true);
		
		medioLitro.setName("medio litro");
		medioLitro.setDefaultPrice(19.0);
		medioLitro.setCost(11.29);
		medioLitro.setStockable(true);
		
		conoWafflePequeno.setName("cono waffle pequeno");
		conoWafflePequeno.setDefaultPrice(7.0);
		conoWafflePequeno.setCost(3.75);
		conoWafflePequeno.setIceCreamWeight(3.25);
		
		conoWafflePequenoCap.setName("cono waffle pequeno capuccino");
		conoWafflePequenoCap.setDefaultPrice(8.5);
		conoWafflePequenoCap.setCost(4.75);
		conoWafflePequenoCap.setIceCreamWeight(3.25);
		
		conoWaffleGrande.setName("cono waffle grande");
		conoWaffleGrande.setDefaultPrice(9.0);
		conoWaffleGrande.setCost(5.0);
		conoWaffleGrande.setIceCreamWeight(4.0);
		
		conoWaffleGrandeCap.setName("cono waffle grande cappucino");
		conoWaffleGrandeCap.setDefaultPrice(10.5);
		conoWaffleGrandeCap.setCost(6.0);
		conoWaffleGrandeCap.setIceCreamWeight(4.0);
		
		conoConoso.setName("cono conoso");
		conoConoso.setDefaultPrice(7.5);
		conoConoso.setCost(4.0);
		conoConoso.setIceCreamWeight(3.5);
		
		conoConosoCap.setName("cono conoso cappucino");
		conoConosoCap.setDefaultPrice(9.0);
		conoConosoCap.setCost(5.0);
		conoConosoCap.setIceCreamWeight(3.5);
		
		fruitSundae.setName("fruit sundae");
		fruitSundae.setDefaultPrice(18.5);
		fruitSundae.setCost(10.0);
		fruitSundae.setIceCreamWeight(4.0);
		
		bananaSplit.setName("banana split");
		bananaSplit.setDefaultPrice(19.0);
		bananaSplit.setCost(10.0);
		bananaSplit.setIceCreamWeight(6.0);
		
		milkShake.setName("milk shake");
		milkShake.setDefaultPrice(17.0);
		milkShake.setCost(10.0);
		milkShake.setIceCreamWeight(6.0);
		
		pepsiFloat.setName("pepsi float");
		pepsiFloat.setDefaultPrice(13.5);
		pepsiFloat.setCost(7.0);
		pepsiFloat.setIceCreamWeight(3.5);
		
		smoothie.setName("smoothie");
		smoothie.setDefaultPrice(12.0);
		smoothie.setCost(6.0);
		smoothie.setIceCreamWeight(3.5);
		
		frappucino.setName("frappucino");
		frappucino.setDefaultPrice(17.0);
		frappucino.setCost(9.0);
		frappucino.setIceCreamWeight(3.5);
		
		pinocchio.setName("pinocchio");
		pinocchio.setDefaultPrice(15.0);
		pinocchio.setCost(10.0);
		pinocchio.setIceCreamWeight(4.0);
		
		baileys.setName("baileys");
		baileys.setDefaultPrice(15.0);
		baileys.setCost(10.0);
		baileys.setIceCreamWeight(4.0);
		
		helados.setName("peso helados");
		helados.setDefaultPrice(25.0);
		helados.setCost(16.68);
		helados.setMetric("libra");
		helados.setStockable(true);
		helados.setSaleable(false);
		
		guateAzul.setName("guate azul");
		guateAzul.setCost(6.5);
		guateAzul.setDefaultPrice(15.0);
		guateAzul.setCocktailWeight(22.0);
		
		pinaColada.setName("pina colada");
		pinaColada.setCost(5.5);
		pinaColada.setDefaultPrice(15.0);
		pinaColada.setCocktailWeight(22.0);
		
		amarettoColada.setName("amaretto colada");
		amarettoColada.setCost(6.0);
		amarettoColada.setDefaultPrice(15.0);
		amarettoColada.setCocktailWeight(22.0);
		
		wodkaSunrise.setName("wodka sunrise");
		wodkaSunrise.setCost(5.0);
		wodkaSunrise.setDefaultPrice(15.0);
		wodkaSunrise.setCocktailWeight(22.0);
		
		swimmingPool.setName("swimming pool");
		swimmingPool.setCost(7.0);
		swimmingPool.setDefaultPrice(15.0);
		swimmingPool.setCocktailWeight(22.0);
		
		curacaoVerde.setName("curacao verde");
		curacaoVerde.setCost(7.0);
		curacaoVerde.setDefaultPrice(15.0);
		curacaoVerde.setCocktailWeight(22.0);
		
		espresso.setName("espresso");
		espresso.setCost(3.0);
		espresso.setDefaultPrice(7.0);
		
		cafeAmericano.setName("cafe americano");
		cafeAmericano.setCost(3.0);
		cafeAmericano.setDefaultPrice(7.0);
		
		cafeLeche.setName("cafe leche");
		cafeLeche.setCost(3.5);
		cafeLeche.setDefaultPrice(8.0);
		
		cappuccino.setName("cappuccino");
		cappuccino.setCost(4.0);
		cappuccino.setDefaultPrice(9.0);
		
		moccacino.setName("moccacino");
		moccacino.setCost(4.0);
		moccacino.setDefaultPrice(9.0);
		
		chocolate.setName("chocolate");
		chocolate.setCost(4.0);
		chocolate.setDefaultPrice(9.0);
		
		jugo.setName("jugo");
		jugo.setCost(2.25);
		jugo.setDefaultPrice(5.0);
		jugo.setCocktailWeight(22.0);
		
		poporropos.setName("poporropos");
		poporropos.setCost(3.0);
		poporropos.setDefaultPrice(6.0);
		
		cocktails.setName("cocktails");
		cocktails.setCost(12.0);
		cocktails.setMetric("libra");
		cocktails.setStockable(true);
		cocktails.setSaleable(false);
		cocktails.setDefaultPrice(30.0);
	}
	
    @SearchableProperty
	private String name;
	
    @SearchableProperty
	private String metric = "unidad";
    
    @SearchableProperty
	private Double defaultPrice;
    
    @SearchableProperty
    private Double cost;
    
    @SearchableProperty
    private Double iceCreamWeight;
    
    @SearchableProperty
    private Double cocktailWeight;
    
    @SearchableProperty
    private boolean stockable;
    
    @SearchableProperty
    private boolean saleable = true;

	public Product() {
	}

	public Double getDefaultPrice() {
		return defaultPrice;
	}
	public Double getCost() {
		return cost;
	}
	public void setCost(Double cost) {
		this.cost = cost;
	}
	public String getMetric() {
		return metric;
	}
	public String getName() {
		return name;
	}
	public void setDefaultPrice(Double defaultPrice) {
		this.defaultPrice = defaultPrice;
	}
	public void setMetric(String metric) {
		this.metric = metric;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setIceCreamWeight(Double iceCreamWeight) {
		this.iceCreamWeight = iceCreamWeight;
	}
	public Double getIceCreamWeight() {
		return iceCreamWeight;
	}
	public void setStockable(boolean stockable) {
		this.stockable = stockable;
	}
	public void setSaleable(boolean saleable) {
		this.saleable = saleable;
	}
	public boolean isSaleable() {
		return saleable;
	}
	public boolean isStockable() {
		return stockable;
	}
	public void setCocktailWeight(Double cocktailWeight) {
		this.cocktailWeight = cocktailWeight;
	}
	public Double getCocktailWeight() {
		return cocktailWeight;
	}
	
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (!(obj instanceof Product))
			return false;
		Product other = (Product) obj;
		return ObjectUtil.equals(other.name, name);
	}

	public static Product getProduct(String name) {
		for (int i = 0; i < products.length; i++) {
			if(products[i].getName().equals(name))
				return products[i];
		}
		return null;
	}
}
